home *** CD-ROM | disk | FTP | other *** search
- /*
- * Yamana's Otomeza Plug-in Tool
- * かすれ線
- *
- * 1995.08.01 かすれペン
- * 1995.08.13 逆方向サポート
- * 1995.08.27 線指定に改悪(^^;)
- *
- * 問題点
- * ・ペンよりかなり使いにくい
- * 仕方のないところか・・・
- *
- */
- #include "otome_pi.h"
- #include "my_hatch.h"
-
- #define MAXPAT (HATCH_MAX/4) /* ハッチング最大 */
- #define MAXVAL (HATCH_MAX/4) /* かすれ度合い最大 */
-
- const char longname[] = "EFFECT: かすれ線";
- int cnfg_max = 3;
- PI_CNFG cnfg[] = {
- {"ペンの濃さ →淡" , 0, MAXPAT-1, 0, 0 },
- // {"かすれやすさ→淡" , 1, MAXVAL-1,MAXVAL/2, MAXVAL/2 },
- {"ペンの大きさ" , 1, 32, 16, 16 },
- {"濃淡逆転" , 0, 1, 0, 0 },
- };
-
- #define USE_ENV PI_SET_ENV
- #define USE_TYPE PI_DRAW_LINE
- #define USE_PEN PI_USER_PEN
-
- #include "otome_pi.c"
-
- /*******************************************************/
-
- int APL_exec()
- {
- int pat,val,size,mode;
- int x,y,ox,oy;
- int rsin,rcos;
- int l,len, lstep,pstep;
- int hpat,minpat;
- LINE connect;
- FRAME fr;
-
- pat = cnfg[0].val * 4 ;
- // val = (MAXVAL-cnfg[1].val)/2; if( val==0 ) val = 1;
- size = cnfg[1].val;
- mode = cnfg[2].val;
-
- hpat = HATCH_MAX - pat ;
- if( mode )
- { minpat = pat;
- pat = HATCH_MAX;
- }
-
- memcpy( &fr, g_para+2, 2*4 );
-
- x = (fr.lupx - fr.rdwx);
- y = (fr.lupy - fr.rdwy);
- len = sqrt( x*x + y*y );
- if( len == 0 || hpat == 0 ) return ERROR;
-
- rsin = -y*256 / len;
- rcos = -x*256 / len;
-
- if( len > hpat )
- { lstep = len/hpat;
- pstep = 1;
- }else
- { lstep = 1;
- pstep = hpat/len;
- }
-
- EGB_mask ( EgbPtr, EGB_MASK_OFF );
- EGB_writePage ( EgbPtr, PI_PAGE );
- EGB_pen ( EgbPtr, 0 ); /* 丸 */
- EGB_penSize ( EgbPtr, size );
- EGB_paintMode ( EgbPtr, EGB_PAINT_HATCHF );
- EGB_color ( EgbPtr, EGB_FORECOL, PI_FORECOL );
-
- connect.n=2;
- ox=fr.lupx, oy=fr.lupy;
- if( mode == 0 ) pat -= pstep;
- else pat += pstep;
-
- for( l=lstep; l<=len; l+=lstep )
- {
- x = fr.lupx + (l * rcos >>8);
- y = fr.lupy + (l * rsin >>8);
-
- if( mode == 0 )
- if( pat+pstep< HATCH_MAX ) pat += pstep ;
- else pat = HATCH_MAX;
- else
- if( pat-pstep>= minpat ) pat -= pstep ;
- else pat = minpat;
-
- EGB_hatchingPattern( EgbPtr, EGB_FORECOL,
- HATCH_X, HATCH_Y, hatchData[pat] );
-
- connect.x0 = ox; connect.y0 = oy;
- connect.x1 = x ; connect.y1 = y;
-
- EGB_connect( EgbPtr, &connect );
-
- ox=x, oy=y;
-
- }
-
- /* 乙女座が画面の再描画をする範囲を返す */
- /* 全画面を設定して返すのが手っ取り早いが386機では差が出る */
- ret_fr->lupx = ( (fr.lupx < fr.rdwx) ? fr.lupx:fr.rdwx )-32 ;
- ret_fr->lupy = ( (fr.lupy < fr.rdwy) ? fr.lupy:fr.rdwy )-32 ;
- ret_fr->rdwx = ( (fr.lupx > fr.rdwx) ? fr.lupx:fr.rdwx )+32 ;
- ret_fr->rdwy = ( (fr.lupy > fr.rdwy) ? fr.lupy:fr.rdwy )+32 ;
-
- return NOERR;
- }
-
-